import Layout from '@/views/Amobile/components/Layout/Tabbar.vue';
export const MRouter = [
  {
    path: '/login',
    component: () => import('@/views/Amobile/Login/index'),
    meta: { title: '登录' }
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: to => {
      // 方法接收目标路由作为参数
      // return 重定向的字符串路径/路径对象
      return { name: 'Index', query: { q: to.params.searchText } };
    }
  },
  {
    path: '',
    component: Layout,
    redirect: '/index',
    children: [
      {
        path: 'Index',
        name: 'Index',
        component: () => import('@/views/Amobile/index'),
        meta: { title: '首页' }
      },
      {
        path: 'Information',
        name: 'Information',
        component: () => import('@/views/Amobile/Information/index'),
        meta: { title: '个人信息' }
      },
      {
        path: 'PassWord',
        name: 'PassWord',
        component: () => import('@/views/Amobile/Information/PassWord'),
        meta: { title: '修改密码' }
      }
    ]
  },
  {
    path: '/SixManage',
    title: '',
    component: Layout,
    children: [
      {
        path: 'Index',
        component: () => import('@/views/Amobile/SixManage/index'),
        meta: { title: '6S管理' }
      },
      {
        path: 'MySix',
        name: 'MySix',
        component: () => import('@/views/Amobile/SixManage/MySix'),
        meta: { title: '我的6S' }
      },
      {
        path: 'SixDetail',
        name: 'SixDetail',
        component: () => import('@/views/Amobile/SixManage/SixDetail'),
        meta: { title: '6S详情' }
      },
      {
        path: 'SubmitSix',
        name: 'SubmitSix',
        component: () => import('@/views/Amobile/SixManage/SubmitSix'),
        meta: { title: '提交6S' }
      },
      {
        path: 'SixHistory',
        name: 'SixHistory',
        component: () => import('@/views/Amobile/SixManage/SixHistory'),
        meta: { title: '6S处理记录' }
      }
    ]
  },
  {
    path: '/DeviceManage',
    name: 'DeviceManage',
    component: Layout,
    title: '设备管理',
    children: [
      {
        path: 'ScanCode',
        path: 'ScanCode',
        component: () => import('@/views/Amobile/DeviceManage/ScanCode'),
        meta: { title: '扫描二维码' }
      },
      {
        path: 'Index',
        component: () => import('@/views/Amobile/DeviceManage/index'),
        meta: { title: '装备管理' }
      },
      {
        path: 'DeviceMaintain',
        path: 'DeviceMaintain',
        component: () => import('@/views/Amobile/DeviceManage/DeviceMaintain'),
        meta: { title: '装备保养' }
      },
      {
        path: 'DeviceAccount',
        path: 'DeviceAccount',
        component: () => import('@/views/Amobile/DeviceManage/DeviceAccount'),
        meta: { title: '装备台账' }
      },
      {
        path: 'MaintainLogList',
        path: 'MaintainLogList',
        component: () => import('@/views/Amobile/DeviceManage/MaintainLogList'),
        meta: { title: '装备保养记录' }
      },
      {
        path: 'MaintainDetail',
        path: 'MaintainDetail',
        component: () => import('@/views/Amobile/DeviceManage/MaintainDetail'),
        meta: { title: '保养详情' }
      }
    ]
  },
  {
    path: '/ToolManage',
    name: 'ToolManage',
    component: Layout,
    title: '工具管理',
    children: [
      {
        path: 'Index',
        component: () => import('@/views/Amobile/ToolManage/index'),
        meta: { title: '工具管理' }
      }
    ]
  },
  {
    path: '/CourseManage',
    name: 'CourseManage',
    component: Layout,
    title: '作业管理',
    children: [
      {
        path: '',
        component: () => import('@/views/Amobile/CourseManage/index'),
        meta: { title: '作业管理' }
      },
      {
        path: 'MyCourseWork',
        name: 'MyCourseWork',
        component: () => import('@/views/Amobile/CourseManage/MyCourseWork'),
        meta: { title: '我的作业' }
      },
      {
        path: 'MyCourseWorkDetail',
        name: 'MyCourseWorkDetail',
        component: () =>
          import('@/views/Amobile/CourseManage/MyCourseWorkDetail'),
        meta: { title: '作业详情' }
      },
      {
        path: 'MySchedule',
        name: 'MySchedule',
        component: () => import('@/views/Amobile/CourseManage/MySchedule'),
        meta: { title: '我的课表' }
      }
    ]
  }
];

export default { MRouter };
